/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package textfilewriter.entity.fact;

import java.text.SimpleDateFormat;
import java.util.Date;
import textfilewriter.entity.dimension.Customer;

/**
 *
 * @author GiangLT
 */
public class MessageServiceUsage {

    private Date date;
    private String mdnFrom;
    private String mdnTo;
    private Customer customer;
    private String network;
    private String successfulness;
    private double charged;
    private String content;
    private int messageLength;
    private int numOfFailedConnections;
    private int avgNumOfMsgsPerContentUnit;

    public MessageServiceUsage() {
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getMdnFrom() {
        return mdnFrom;
    }

    public void setMdnFrom(String mdnFrom) {
        this.mdnFrom = mdnFrom;
    }

    public String getMdnTo() {
        return mdnTo;
    }

    public void setMdnTo(String mdnTo) {
        this.mdnTo = mdnTo;
    }

    public int getMessageLength() {
        return messageLength;
    }

    public void setMessageLength(int messageLength) {
        this.messageLength = messageLength;
    }

    public int getAvgNumOfMsgsPerContentUnit() {
        return avgNumOfMsgsPerContentUnit;
    }

    public void setAvgNumOfMsgsPerContentUnit(int avgNumOfMsgsPerContentUnit) {
        this.avgNumOfMsgsPerContentUnit = avgNumOfMsgsPerContentUnit;
    }

    public Customer getCustomer() {
        return customer;
    }

    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public String getNetwork() {
        return network;
    }

    public void setNetwork(String network) {
        this.network = network;
    }

    public int getNumOfFailedConnections() {
        return numOfFailedConnections;
    }

    public void setNumOfFailedConnections(int numOfFailedConnections) {
        this.numOfFailedConnections = numOfFailedConnections;
    }

    public String getSuccessfulness() {
        return successfulness;
    }

    public void setSuccessfulness(String successfulness) {
        this.successfulness = successfulness;
    }

    public double getCharged() {
        return charged;
    }

    public void setCharged(double charged) {
        this.charged = charged;
    }

    @Override
    public String toString() {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        StringBuilder sb = new StringBuilder();
        sb.append(dateFormat.format(date));
        sb.append("|");
        sb.append(customer.getCustFirstName());
        sb.append(" ");
        sb.append(customer.getCustLastName());
        sb.append("|");
        sb.append(customer.getCustStreetAddress());
        sb.append("|");
        sb.append(mdnFrom);
        sb.append("|");
        sb.append(mdnTo);
        sb.append("|");
        sb.append(messageLength);
        sb.append("|");
        sb.append(network);
        sb.append("|");
        sb.append(successfulness);
        sb.append("|");
        sb.append(charged);
        sb.append(" ");
        sb.append("VND");
        sb.append("|");
        sb.append(content);

        return sb.toString();
    }

    public String getHeader() {
        return "Date|Customer name|Customer Address|From|To|Msg Length|Network|Sent|Fee|Content";
    }

    
}
